package logic

import (
	"context"
	"lm/lmrpc/lmrpcclient"

	"lm/api/internal/svc"
	"lm/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type LmShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewLmShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LmShowLogic {
	return &LmShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *LmShowLogic) LmShow(req *types.LmShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.LmRpc.LmShow(l.ctx, &lmrpcclient.LmShowRequest{
		LmId: int64(req.LmId),
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Data:    500,
			Code:    nil,
		}, nil
	}

	return &types.Response{
		Message: "查询成功",
		Data:    200,
		Code:    show,
	}, nil

}
